package com.xmy.cultivate.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xmy.cultivate.entity.AuthAllotTeacher;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xmy.cultivate.entity.TeacherPoint;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 教师权限表 Mapper 接口
 * </p>
 *
 * @author hpiggy
 * @since 2025-05-10
 */
public interface AuthAllotTeacherMapper extends BaseMapper<AuthAllotTeacher> {

    @Select({ "<script>",
            "SELECT t2.`name` AS teacher_name, t1.* FROM auth_allot_teacher t1",
            "LEFT JOIN staff t2 ON t1.teacher_id = t2.id",
            "WHERE 1=1",
            "and t1.created_id =${adminId}",
            "<if test ='teacherName != null and teacherName !=&apos;&apos;'>",
            "AND t2.name LIKE '%${teacherName}%'",
            "</if>",
            "ORDER BY t1.created_at DESC",
            "</script>"})
    public IPage<AuthAllotTeacher> getAuthAllotTeacherList(IPage<AuthAllotTeacher> page,@Param("adminId") Long adminId, @Param("teacherName") String teacherName);

}
